package com.fw.ui.view;

import org.springframework.beans.factory.InitializingBean;

import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.VerticalLayout;

public abstract class AbstractView extends VerticalLayout implements View, InitializingBean {// TODO , LocaleChangedListener {

    private static final long serialVersionUID = -2538705493241922045L;

    @Override
    public void enter(ViewChangeEvent event) {
	this.init();
	this.initListener();
	this.initValidator();
	this.initData();
	this.updateStrings();
    }

    @Override
    public void afterPropertiesSet() throws Exception {
	// TODO Auto-generated method stub

    }

    @Override
    public void attach() {
	super.attach();
	// TODO I18NHolder.get().addLocaleChangedListener(this);
    }

    @Override
    public void detach() {
	// TODO I18NHolder.get().removeLocaleChangedListener(this);
	super.detach();
    }

    public abstract void updateStrings();

    // TODO @Override
    // public void localeChanged(LocaleChangedEvent event) {
    // this.updateStrings();
    // }

    public abstract void init();

    public abstract void initListener();

    public abstract void initValidator();
    
    public abstract void initData();

}
